package com.och.mrcp.core.sip.model;

import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class SipRequest extends SipMessage {
    
    private String method;
    private String requestUri;
    private String sipVersion = "SIP/2.0";
    
    public SipRequest() {
        super();
    }
    
    public SipRequest(String method, String requestUri) {
        this();
        this.method = method;
        this.requestUri = requestUri;
        setStartLine();
    }
    
    @Override
    public String getMethod() {
        return method;
    }
    
    @Override
    public boolean isRequest() {
        return true;
    }
    
    @Override
    public boolean isResponse() {
        return false;
    }
    
    public void setStartLine() {
        this.startLine = method + " " + requestUri + " " + sipVersion;
    }
    
    public static SipRequest createInvite(String requestUri) {
        return new SipRequest("INVITE", requestUri);
    }
    
    public static SipRequest createAck(String requestUri) {
        return new SipRequest("ACK", requestUri);
    }
    
    public static SipRequest createBye(String requestUri) {
        return new SipRequest("BYE", requestUri);
    }
    
    public static SipRequest createCancel(String requestUri) {
        return new SipRequest("CANCEL", requestUri);
    }
    
    public static SipRequest createOptions(String requestUri) {
        return new SipRequest("OPTIONS", requestUri);
    }
    
    public static SipRequest createRegister(String requestUri) {
        return new SipRequest("REGISTER", requestUri);
    }
}
